from flask_bootstrap import Bootstrap4
from flask_login import LoginManager
from flask_mail import Mail
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from flask_migrate import Migrate


bootstrap = Bootstrap4()
db = SQLAlchemy()
login = LoginManager()
csrf = CSRFProtect()
mail = Mail()
moment = Moment()
migrate = Migrate()


login.login_view = 'admin.login'
login.login_message = '请登录访问此页面'


@login.user_loader
def load_user(id):
	from app.models import User
	return User.query.get(int(id))